{
  "cells": [
    {
      "cell_type": "code",
      "execution_count": 3,
      "metadata": {
        "id": "Tq7xqEeCdYAF"
      },
      "outputs": [],
      "source": [
        "from dataclasses import dataclass"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 22,
      "metadata": {
        "id": "PnZmcPWKdjPi"
      },
      "outputs": [],
      "source": [
        "from typing import ClassVar\n",
        "\n",
        "@dataclass\n",
        "class American:\n",
        "  national_language: ClassVar[str] = \"English\"\n",
        "  national_food: ClassVar[str] = \"Hamburger\"\n",
        "  normal_body_temperature: ClassVar[float] = 98.6\n",
        "  name: str\n",
        "  age: int\n",
        "  weight: float\n",
        "  liked_food: str\n",
        "\n",
        "  def speaks(self):\n",
        "    return f\"{self.name} is speaking... {American.national_language}\"\n",
        "\n",
        "  def eats(self):\n",
        "    return f\"{self.name} is eating...\"\n",
        "\n",
        "  @staticmethod\n",
        "  def country_language():\n",
        "    return American.national_language"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 23,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 35
        },
        "id": "JnPKuLWye_iE",
        "outputId": "ed9f4b5d-6e2c-4814-c88e-d2a0945ee843"
      },
      "outputs": [
        {
          "data": {
            "application/vnd.google.colaboratory.intrinsic+json": {
              "type": "string"
            },
            "text/plain": [
              "'English'"
            ]
          },
          "execution_count": 23,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "American.country_language()"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 21,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "cN3EJ7Hgd0_7",
        "outputId": "d4745590-2f83-4bac-fa9e-77067b587f92"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "John is speaking... English\n",
            "John is eating...\n"
          ]
        }
      ],
      "source": [
        "john = American(name=\"John\", age=25, weight=65, liked_food=\"P\")\n",
        "print(john.speaks())\n",
        "print(john.eats())"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 29,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "frUjWYLLfzUY",
        "outputId": "2f4808ae-6fbe-4e0d-cd13-237f7852df21"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "American(name='John', age=25, weight=65)\n",
            "John\n",
            "25\n",
            "65\n",
            "English\n"
          ]
        }
      ],
      "source": [
        "print(john)\n",
        "print(john.name)\n",
        "print(john.age)\n",
        "print(john.weight)\n",
        "print(American.national_language)"
      ]
    }
  ],
  "metadata": {
    "colab": {
      "provenance": []
    },
    "kernelspec": {
      "display_name": "Python 3",
      "name": "python3"
    },
    "language_info": {
      "name": "python"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}
